<template>
  <div class="">
    <input type="text" v-model="username" />
    <input type="text" v-model="password" />
    <button @click="login">登陆</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "",
      password: "",
    };
  },
  mounted() {},
  methods: {
    login() {
      this.$axios
        .post("/login", {
          username: this.username,
          password: this.password,
        })
        .then((res) => {
          console.log(res);
          this.$store.commit("settoken", res.data.data.token);
          this.$router.push("/list");
        });
    },
  },
  components: {},
};
</script>

<style lang="scss"></style>
